/**
 * @author sunshixiong
 * 此配置主要使用antd提供的react-app-rewired实现create-react-app自定义
 * 配置，使用ts-import-plugin实现包的按需加载，import的时候就可以用{xxx}导入
 */

const { override, fixBabelImports, addLessLoader } = require("customize-cra");

module.exports = override(
  fixBabelImports("import", {
    libraryName: "antd",
    libraryDirectory: "es",
    style: true
  }),
  fixBabelImports("@material-ui/core", {
    camel2DashComponentName: false,
    libraryDirectory: "",
    libraryName: "@material-ui/core"
  }),
  fixBabelImports("@material-ui/core/styles", {
    camel2DashComponentName: false,
    libraryDirectory: "",
    libraryName: "@material-ui/core/styles"
  }),
  fixBabelImports("@material-ui/core/colors", {
    camel2DashComponentName: false,
    libraryDirectory: "",
    libraryName: "@material-ui/core/colors"
  }),
  fixBabelImports("@material-ui/icons", {
    camel2DashComponentName: false,
    libraryDirectory: "",
    libraryName: "@material-ui/icons"
  }),
  addLessLoader({
    javascriptEnabled: true,
    modifyVars: {
    }
  })
);
